<template>
    <div id="subtempl">
        <div class="left num " @click="substrict()">-</div>
        <div class="center num">{{count}}</div>
        <div class="right num" @click="add()">+</div>
    </div>
</template>
<script>
 export default {
  data(){
      return{
          count:1
      }
  },
 methods:{
     substrict(){
         this.count--;
         if(this.count <1){
             this.count =1;
         }
         this.sendmessage();
     },
     add(){
         this.count++;
         this.sendmessage();
     },
     sendmessage(){
         this.$emit("countSend",this.count);
     }
 }
 }
</script>
<style scoped>
#subtempl{

}
#subtempl .num{
    display: inline-block;
    width: 35px;
    height: 25px;
    line-height: 25px;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.6);

}
</style>